BigDFT.Interop.PSI4Interop module

This module contains some wrappers for using PSI4 to perform calculations.

https://psicode.org/

class PSI4Calculator(omp='1', skip=False, verbose=True)[source]

Bases: BigDFT.Calculators.Runner

Perform a calculation on a given system using the PSI4 code.

Note that if you intend to use an SAPT method, you need to pass a system which is composed of exactly two fragments.

PSI4 has a number of different actions, ab initio methods, and basis sets. Be sure to specify each of these to the run command.

os = <module 'os' from '/usr/local/anaconda/lib/python3.7/os.py'>
post_processing(logname, command)[source]

Post processing the calculation.

Returns

a representation of the logfile.

Return type

(BigDFT.Interop.PSI4Interop.PSI4Logfile)

pre_processing()[source]

Process local run dictionary to create the input directory and identify the command to be passed

Returns

dictionary containing the command to be passed to process_run()

Return type

dict

process_run(command)[source]

Run the psi4 command.

class PSI4Logfile(sys, fname, action, method)[source]

Bases: dict

A logfile wrapper for an SAPT calculation.

This logfile inherits from a dictionary, as the properties we get out of a calculation depend on the type of calculation performed.

Parameters
  • fname (str) – the name of the file to process.

  • action (str) – the action that was used when running SAPT (energy, optimize, frequency).

  • method (str) – the scf method used.

bigdft_to_psi4(sysA, sysB=None, chargeA=0, multiplicityA=None, chargeB=0, multiplicityB=None)[source]

Create a PSI4 dimer molecule which can be used for SAPT.

If multiple molecules are specified, we create a Dimer system.

Parameters
  • sysA (BigDFT.Systems.System) – the first molecule.

  • sysB (BigDFT.Systems.System) – the second molecule (optional).

  • chargeA (int) – the charge of the first molecule.

  • chargeB (int) – the charge of the second molecule.

  • multiplicityA (int) – the multiplicity for unpaired electrons.

  • multiplicityB (int) – the multiplicity for unpaired electrons.

Returns

the psi4 geometry.

Return type

(psi4.core.Molecule)

BigDFT.Interop.PSI4Interop example

Below we show an example of using the PSI4 interoperability functions.

def _example():
    """Example of using PSI4 interoperability"""
    from BigDFT.IO import XYZReader
    from BigDFT.Systems import System
    from BigDFT.Fragments import Fragment
    from os.path import join
    from copy import deepcopy

    # Create a system.
    reader = XYZReader(join("Database", "XYZs", "He.xyz"))
    fsys = System()
    fsys["FRA:1"] = Fragment(xyzfile=reader)
    fsys["FRA:2"] = deepcopy(fsys["FRA:1"])
    fsys["FRA:2"].translate([-2, 0, 0])

    # Create a calculator.
    code = PSI4Calculator()
    log = code.run(sys=fsys, action="energy", basis="jun-cc-pvdz",
                   psi4_options={"scf_type": "direct"}, method="scf",
                   name="test")
    print(log)

    # The raw logfile is also available.
    print(log.log[4])

    # Geometry optimization.
    log = code.run(sys=fsys, action="optimize", basis="jun-cc-pvdz",
                   method="scf", name="test-opt")
    print(log)

    # SAPT
    log = code.run(sys=fsys, action="energy", basis="jun-cc-pvdz",
                   method="sapt0", name="test-sapt")
    print(log)